#include<iostream>
using namespace std;

class Solution {
public:
    bool isPalindrome(string s) {
        string st;
        string::iterator begi = s.begin();
        while (begi <= s.end() - 1)
        {
            if (
                (*begi >= 'a' && *begi <= 'z') ||
                (*begi >= 'A' && *begi <= 'Z') ||
                (*begi >= '0' && *begi <= '9')
                )
            {
                st.push_back(tolower(*begi));
                ++begi;
            }
            else
            {
                ++begi;
            }
        }
        string::iterator i = st.begin();
        string::iterator j = st.end() - 1;
        while (i < j)
        {
            if (*i != *j)
            {
                return false;
            }
            ++i;
            --j;
        }
        return true;
    }
};




class Solution {
public:
    int firstUniqChar(string s) {
        int i = 0;
        for (i = 0; i < s.size(); i++)
        {
            if (s.find(s[i]) == s.rfind(s[i]))
            {
                return i;
            }
        }
        return -1;
    }
};




class Solution {
public:
    string reverseStr(string s, int k) {
        string::iterator it = s.begin();
        int n = s.size() / (2 * k);
        int e = s.size() % (2 * k);
        while (n)
        {
            reverse(it, it + k);
            it = it + 2 * k;
            --n;
        }
        if (e >= k)
        {
            reverse(it, it + k);
        }
        else
        {
            reverse(it, s.end());
        }
        return s;
    }
};